﻿using HamcoWcs.Models.Common.Enums;
using HamcoWcs.Models.SubTasks;
using System;
using System.Collections.Generic;

namespace HamcoWcs.Models.MainTasks
{
    public class MainTaskDto
    {
        public MainTaskDto()
        {
        }

        //public MainTaskDto(string unitId, ExtendDto extend, string taskId = "") : this()
        //{
        //    //UnitId = unitId;
        //    //Extend = extend;
        //    //FromLoc = extend.FromAddress.MachineName;
        //    //ToLoc = extend.ToAddress.MachineName;

        //    //if (string.IsNullOrEmpty(TaskId))
        //    //{
        //    //    Sender = "WCS";
        //    //    TaskId = $"{DateTime.Now:yyyyMMddHHmmssfff}-{unitId}-WCS";
        //    //}
        //    //else
        //    //{
        //    //    Sender = "MES";
        //    //    TaskId = taskId;
        //    //}

        //    //MainTaskType = GetTaskType(extend.FromAddress.PositionType, extend.ToAddress.PositionType);
        //}


        public long Id { get; set; }
        public string Sender { get; set; }
        public string TaskId { get; set; }
        public string FromLoc { get; set; }
        public string ToLoc { get; set; }
        public string UnitId { get; set; }
        public string Priority { get; set; }
        public string Extend { get; set; }

        //================================================
        public string SrcMachine { get; set; }
        public string SrcPosition { get; set; }
        public string SrcType { get; set; }
        public string SrcZone { get; set; }
        public string DesMachine { get; set; }
        public string DesPosition { get; set; }
        public string DesType { get; set; }
        public string DesZone { get; set; }
        public string OldDesMachine { get; set; }
        public string OldDesPosition { get; set; }
        public string OldDesType { get; set; }
        public string OldDesZone { get; set; }
        public int SrcPriority { get; set; }
        public int DesPriority { get; set; }
        //public int IsHandOff { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime CompleteTime { get; set; }
        public int IsReportStart { get; set; }
        public string TransactionId { get; set; }
        public string Path { get; set; }

        ///================================================
        public int Distance { get; set; }
        //public ExtendDto Extend { get; set; }
        public string ReasonCode { get; set; }
        public EnumMainTaskType MainTaskType { get; set; }
        public int ActiveSubTaskId { get; set; }
        public int TotalSubTaskNum { get; set; }
        public DateTime CreatedTime { get; set; }
        public EnumMainTaskStatus TaskStatus { get; set; }
        public List<SubTaskDto> SubTasks { get; set; } = new List<SubTaskDto>();

    }
}
